package nme.installer;


import nme.display.Bitmap;
import nme.display.BitmapData;
import nme.media.Sound;
import nme.net.URLRequest;
import nme.text.Font;
import nme.utils.ByteArray;
import ApplicationMain;


/**
 * ...
 * @author Joshua Granick
 */

class Assets {

	
	public static function getBitmapData (id:String):BitmapData {
		
		// Should be bitmapData.clone (), but stopped working in recent Jeash builds
		
		switch (id) {
			
			case "assets/NO.png": return cast (ApplicationMain.loaders.get ("assets/NO.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/ResetSavedData.png": return cast (ApplicationMain.loaders.get ("assets/ResetSavedData.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/Credits.png": return cast (ApplicationMain.loaders.get ("assets/Credits.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/MainMenu.png": return cast (ApplicationMain.loaders.get ("assets/MainMenu.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/audioMute.png": return cast (ApplicationMain.loaders.get ("assets/audioMute.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/Yes.png": return cast (ApplicationMain.loaders.get ("assets/Yes.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/BLAAMMute.png": return cast (ApplicationMain.loaders.get ("assets/BLAAMMute.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/Options.png": return cast (ApplicationMain.loaders.get ("assets/Options.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/StartButton.png": return cast (ApplicationMain.loaders.get ("assets/StartButton.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/Back.png": return cast (ApplicationMain.loaders.get ("assets/Back.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/audio.png": return cast (ApplicationMain.loaders.get ("assets/audio.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/Menu.png": return cast (ApplicationMain.loaders.get ("assets/Menu.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/button.png": return cast (ApplicationMain.loaders.get ("assets/button.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/TextBackground.png": return cast (ApplicationMain.loaders.get ("assets/TextBackground.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/Background.png": return cast (ApplicationMain.loaders.get ("assets/Background.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/ContinueGame.png": return cast (ApplicationMain.loaders.get ("assets/ContinueGame.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/icon.png": return cast (ApplicationMain.loaders.get ("assets/icon.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/Instructions.png": return cast (ApplicationMain.loaders.get ("assets/Instructions.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/CircleBackground.png": return cast (ApplicationMain.loaders.get ("assets/CircleBackground.png").contentLoaderInfo.content, Bitmap).bitmapData;
			case "assets/BLAAM.png": return cast (ApplicationMain.loaders.get ("assets/BLAAM.png").contentLoaderInfo.content, Bitmap).bitmapData;
			
		}
		
		return null;
		
	}
	
	
	public static function getBytes (id:String):ByteArray {
		
		switch (id) {
			
			//case "assets/NO.png": return ByteArray.readFile ("assets/NO.png");
			//case "assets/ResetSavedData.png": return ByteArray.readFile ("assets/ResetSavedData.png");
			//case "assets/Credits.png": return ByteArray.readFile ("assets/Credits.png");
			//case "assets/MainMenu.png": return ByteArray.readFile ("assets/MainMenu.png");
			//case "assets/audioMute.png": return ByteArray.readFile ("assets/audioMute.png");
			//case "assets/Background.mp3": return ByteArray.readFile ("assets/Background.mp3");
			//case "assets/Yes.png": return ByteArray.readFile ("assets/Yes.png");
			//case "assets/BLAAMMute.png": return ByteArray.readFile ("assets/BLAAMMute.png");
			//case "assets/Options.png": return ByteArray.readFile ("assets/Options.png");
			//case "assets/StartButton.png": return ByteArray.readFile ("assets/StartButton.png");
			//case "assets/Back.png": return ByteArray.readFile ("assets/Back.png");
			//case "assets/audio.png": return ByteArray.readFile ("assets/audio.png");
			//case "assets/Menu.png": return ByteArray.readFile ("assets/Menu.png");
			//case "assets/button.png": return ByteArray.readFile ("assets/button.png");
			//case "assets/TextBackground.png": return ByteArray.readFile ("assets/TextBackground.png");
			//case "assets/Background.png": return ByteArray.readFile ("assets/Background.png");
			//case "assets/ContinueGame.png": return ByteArray.readFile ("assets/ContinueGame.png");
			//case "assets/icon.png": return ByteArray.readFile ("assets/icon.png");
			//case "assets/Instructions.png": return ByteArray.readFile ("assets/Instructions.png");
			//case "assets/CircleBackground.png": return ByteArray.readFile ("assets/CircleBackground.png");
			//case "assets/BLAAM.png": return ByteArray.readFile ("assets/BLAAM.png");
			//
		}
		
		return null;
		
	}
	
	
	public static function getFont (id:String):Font {
		
		switch (id) {
			
			
		}
		
		return null;
		
	}
	
	
	public static function getSound (id:String):Sound {
		
		switch (id) {
			
			case "assets/Background.mp3": return new Sound (new URLRequest ("assets/Background.mp3"));
			
		}
		
		return null;
		
	}
	
	
	public static function getText (id:String):String {
		
		var bytes:ByteArray = getBytes (id);
		
		if (bytes == null) {
			
			return null;
			
		} else {
			
			return bytes.readUTFBytes (bytes.length);
			
		}
		
	}
	
	
}